/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package BLL;

import BE.Artist;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author notandi
 */
public class ArtistManager
{

    private static ArtistManager instance = null;

    private List<Artist> artists;

    private ArtistManager()
    {
        artists = new ArrayList<>();
    }

    public static ArtistManager getInstance()
    {
        if (instance == null)
        {
            instance = new ArtistManager();
        }
        return instance;
    }

    public Artist getById(int id)
    {
        for (Artist a : artists)
        {
            if (a.getId() == id)
            {
                return a;
            }
        }
        return null;
    }

    public Artist getByName(String name)
    {
        for (Artist a : artists)
        {
            if (a.getName().equals(name))
            {
                return a;
            }
        }
        return null;
    }

    public final List<Artist> getAll()
    {
        return artists;
    }
}
